package cn.village.controller;

import cn.village.entity.VaAssetsManagement;
import cn.village.service.VaAssetsManagementService;
import cn.village.utils.PageSupport;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (VaAssetsManagement)表控制层
 *
 * @author makejava
 * @since 2021-03-08 18:59:07
 */
@Controller
@RequestMapping("/")
public class VaAssetsManagementController {
    /**
     * 服务对象
     */
    @Resource
    private VaAssetsManagementService vaAssetsManagementService;



    @RequestMapping("assets-list")
    public String list(Model model){
        List<VaAssetsManagement> vaAssetsManagementList = vaAssetsManagementService.queryByList(0, 4);
        int count=vaAssetsManagementService.count();//查询行数
        model.addAttribute("vaAssetsManagementList",vaAssetsManagementList);
        PageSupport pageSupport =new PageSupport();
        int Page=1;//创建总页数变量
        if (count%4!=0){ pageSupport.setTotalPageCount(Page=count/4+1); }//获取总页数变量

        pageSupport.setPageSize(4);
        pageSupport.setTotalCount(count);//保存行数
//        model.addAttribute("totalPageNo",pageSupport.getTotalPageCount());

        model.addAttribute("totalCount",pageSupport.getTotalCount());
        model.addAttribute("currentPageNo",pageSupport.getCurrentPageNo());
        model.addAttribute("totalPageNo",pageSupport.getTotalPageCount());
        return "assets-list";
    }

//    @RequestMapping("/assets_details")
//    public String assets_details(Model model, @RequestParam Integer id){
//        VaAssetsManagement vaass=vaAssetsManagementService.queryById(id);
//        model.addAttribute("vaass",vaass);
//        return "assets-details";
//    }

//    @RequestMapping("/vaAssetsManagement/list")
//    public String list(Model model) {
//
//        return "assets-list";
//    }

    @RequestMapping("assets-book")
    public String book(){
        return "assets-book";
    }

    @RequestMapping("assets-type")
    public String type(){
        return "assets-type";
    }

    @RequestMapping("assetsadd")
    public String add(){
        return "assets-add";
    }





}


